from database import db


class Order(db.Model):
    __tablename__ = 'Orders'

    id = db.Column(db.INTEGER(), primary_key=True, unique=True)
    userid = db.Column(db.INTEGER(), nullable=False)
    type = db.Column(db.String(100, 'utf8mb4_unicode_ci'), nullable=False)
    desca = db.Column(db.String(255, 'utf8mb4_unicode_ci'), nullable=False)
    descb = db.Column(db.String(255, 'utf8mb4_unicode_ci'), nullable=False)
    status = db.Column(db.Float(), nullable=False)
    time = db.Column(db.DateTime(), nullable=False)
    acc_time = db.Column(db.DateTime(), nullable=True)
    send_time = db.Column(db.DateTime(), nullable=True)
    sent_time = db.Column(db.DateTime(), nullable=True)
    con_time = db.Column(db.DateTime(), nullable=True)
    money = db.Column(db.DECIMAL, nullable=False)
    eid = db.Column(db.INTEGER(), nullable=True)


class Deliver(db.Model):
    __tablename__ = 'Deliver'

    id = db.Column(db.INTEGER(), primary_key=True, unique=True)
    orderid = db.Column(db.INTEGER(), nullable=False)
    userid = db.Column(db.INTEGER(), nullable=False)
    delivernum = db.Column(db.String(100, 'utf8mb4_unicode_ci'), nullable=False)
    yizhan = db.Column(db.String(100, 'utf8mb4_unicode_ci'), nullable=False)
    code = db.Column(db.String(100, 'utf8mb4_unicode_ci'), nullable=False)
    addindex = db.Column(db.INTEGER(), nullable=False)
    type = db.Column(db.String(100, 'utf8mb4_unicode_ci'), nullable=False)
    note = db.Column(db.String(255, 'utf8mb4_unicode_ci'), nullable=False)
    res_time = db.Column(db.String(100, 'utf8mb4_unicode_ci'), nullable=True)


class Print(db.Model):
    __tablename__ = 'Print'
    id = db.Column(db.INTEGER(), primary_key=True, unique=True)
    orderid = db.Column(db.INTEGER(), primary_key=True, unique=True)
    userid = db.Column(db.INTEGER(), primary_key=True, unique=True)
    fid = db.Column(db.INTEGER(), primary_key=True, unique=True)
    fname = db.Column(db.String(255, 'utf8mb4_unicode_ci'), nullable=False)
    addindex = db.Column(db.INTEGER(), primary_key=True, unique=True)
    count = db.Column(db.INTEGER(), primary_key=True, unique=True)
    note = db.Column(db.String(255, 'utf8mb4_unicode_ci'), nullable=False)
    res_time = db.Column(db.String(100, 'utf8mb4_unicode_ci'), nullable=True)
    ziti = db.Column(db.INTEGER(), nullable=True)
    station = db.Column(db.String(100, 'utf8mb4_unicode_ci'), nullable=False)
